const jwt = require('../../utils/jwt')
const CONSTANT = require('../../constant')
exports.login = async (req, res) => {
  const user = req.body;
  delete user.password;
  const token = await jwt.sign({
    user
  }, CONSTANT.JWT_SECRET, {
    expiresIn: 60 * 60 * 24
  })
  res.status(200).json({
    message: '登录成功',
    data: {
      ...user,
      token
    }
  })
}
exports.getUserInfo = async (req, res) => {
  res.status(200).json({
    message: '获取用户信息'
  })
}